# Maintainer: Naveen M K <naveen@syrusdark.website> @naveen521kk on Github.

_realname=glslviewer
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.6.1
pkgrel=1
pkgdesc=" Console-based GLSL Sandbox for 2D/3D shaders shaders (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://github.com/patriciogonzalezvivo/glslViewer"
license=('BSD-3-Clause')
depends=(
  "${MINGW_PACKAGE_PREFIX}-glfw"
  "${MINGW_PACKAGE_PREFIX}-glew"
)
source=(
  "${_realname}-${pkgver}.tar.gz"::"https://github.com/patriciogonzalezvivo/glslViewer/archive/${pkgver}.tar.gz"
  '0001-add-mingw.patch'
  '0002-use-platform-windows-def.patch'
)
sha512sums=('f8c1bfbc89d90d187f66c9a81e4f6eaee22225c66d88d5149dfdfba3db9b6812ebca783d8fd48c05c56da6a3c56cdb928807da47759254eba6d9038fff373fe9'
            '149305ffdc3bac1833fa7319f9cc15c367a3ba21185630424dc71937b16058bf7823f22304e7f43414a7cdd3d183cd4bb6e4b9be0cd57588fde59b3b965788c8'
            'e75585948dfc6144979874b4e9e78c503b584da446ec3ad446ef72e43f04995797a72bc78cbf9732b2866c17095c270b7d2c1ffefab8d99e89ba0b5a53e02b4c')

prepare () {
  cd ${srcdir}/${_realname}-${pkgver}
  patch -Np1 -i ${srcdir}/0001-add-mingw.patch
  patch -Np1 -i ${srcdir}/0002-use-platform-windows-def.patch
  rm -r include/glew-2.1.0/*
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  make
}

package() {
  install -Dm0755 "${srcdir}/${_realname}-${pkgver}/bin/glslViewer.exe" "${pkgdir}${MINGW_PREFIX}/bin/glslViewer.exe"
  install -Dm0755 "${srcdir}/${_realname}-${pkgver}/bin/glslLoader" "${pkgdir}${MINGW_PREFIX}/bin/glslLoader"
  install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.md"
}
